﻿// code03050100.cpp : 数组
// 定义和初始化内置数组

#include <iostream>
using namespace std;

constexpr int get_size();
int main()
{
    unsigned cnt = 42;
    constexpr unsigned sz = 42;

    int arr[10];
    int* parr[sz];                      //int类型指针数组
    string bad[cnt];                    //报错！cnt不是常量表达式
    string strs[get_size()];            //报错！当get_size是constexpr时正确，否则错误

    const unsigned sz1 = 3;
    int a1[sz1] = { 0,1,2 };
    int a2[] = { 0,1,2 };
    int a3[5] = { 0,1,2 };              //a3[]={0,1,2,0,0}
    string a4[3] = { "hi","bye" };      //a4[]={"hi","bye",""}
    int a5[2] = { 0,1,2 };              //报错！溢出

    return 0;

}
